// bottom-bar/bottom-bar.js
Component({
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    list: [
      {
        "pagePath": "/pages/knowledge-base/index",
        "text": "知识库",
        "iconPath": "/images/knowledge-base.png",
        "selectedIconPath": "/images/knowledge-base-select.png"
      },
      {
        "pagePath": "/pages/assessment/index",
        "text": "考核",
        "iconPath": "/images/assessment.png",
        "selectedIconPath": "/images/assessment-select.png"
      },
      {
        "pagePath": "/pages/home/index",
        "text": "首页",
        "iconPath": "/images/logo.png",
        "selectedIconPath": "/images/logo.png",
        "home": true
      },
      {
        "pagePath": "/pages/footprint/index",
        "text": "足迹",
        "iconPath": "/images/footprint.png",
        "selectedIconPath": "/images/footprint-select.png"
      },
      {
        "pagePath": "/pages/settings/index",
        "text": "我的",
        "iconPath": "/images/settings.png",
        "selectedIconPath": "/images/settings-select.png"
      }
    ]
  },
  attached() {
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({ url })
      this.setData({ selected: data.index })
    }
  }
})
